import { defineConfig } from 'vite'
import { resolve } from 'path'

export default defineConfig({
  css: {
    preprocessorOptions: {
      scss: {
        charset: false,
        additionalData: `@use "@/styles/variables.scss" as *;`
      }
    }
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  build: {
    outDir: 'dist',
    emptyOutDir: false,
    cssCodeSplit: true,
    assetsDir: 'styles',
    minify: true,
    sourcemap: true,
    rollupOptions: {
      input: {
        style: resolve(__dirname, 'src/styles/index.scss')
      },
      output: {
        assetFileNames: (assetInfo) => {
          if (assetInfo.name === 'style.css') return 'styles/index.css'
          if (assetInfo.name === 'style.css.map') return 'styles/index.css.map'
          return 'styles/[name][extname]'
        }
      }
    }
  }
}) 